#if !defined(ximera_math_matrix4_hpp)
#define ximera_math_matrix4_hpp

// -----------------------------------------------------------

namespace ximera { namespace math
{
    class XIMERA_API Matrix4
    {
    public:
        Matrix4();
        Matrix4(bool zero);
        Matrix4(Real const array[4][4]);
        Matrix4(Real m00, Real m01, Real m02, Real m03,
            Real m10, Real m11, Real m12, Real m13,
            Real m20, Real m21, Real m22, Real m23,
            Real m30, Real m31, Real m32, Real m33);

        Real* operator[](int row);
        Real const* operator[](int row) const;

        Real& operator()(int row, int col);
        Real operator()(int row, int col) const;

        void makeIdentity();
        void makeZero();

        Real* asArray();
        Real const* asArray() const;

        Matrix4& transpose();
        Matrix4 asTranspose() const;

        Matrix4& inverse();
        Matrix4 asInverse() const;

        Matrix4& add(Matrix4 const& matrix);
        Matrix4& subtract(Matrix4 const& matrix);
        Matrix4& multiply(Matrix4 const& matrix);

        Matrix4& operator+=(Matrix4 const& rhs);
        Matrix4& operator-=(Matrix4 const& rhs);
        Matrix4& operator*=(Real rhs);
        Matrix4& operator/=(Real rhs);

        static Matrix4 const ZERO;
        static Matrix4 const IDENTITY;

    private:
        union {
            Real _matrix[4][4];
            Real _array[4*4];
        };
    };
}}

// -----------------------------------------------------------

#endif